import request from "@/utils/request.js";

/**
 * 获取二手商品列表
 */
export function getSecondHand(data) {
	return request.get('getSecondHand', data, {
		noAuth: true
	})
}

/**
 * 搜索二手商品
 */
export function searchSecondHand(data) {
    return request.get('searchSecondHand', data, {
        noAuth: true
    });
}

/**
 * 上传/修改闲置信息
 */
export function productEdit(data) {
    return request.post('second_hand/productEdit', data);
}

/**
 * 获取用户所有二手商品
 */
export function getSecondHandProducts(data) {
    return request.get('second_hand/getSecondHandProducts', data)
}

/**
 * 获取单个二手商品
 */
export function getSecondHandProduct(id) {
    return request.get('second_hand/getSecondHandProduct/' + id)
}

/**
 * 卖出的订单列表
 */
export function getSoldList(where) {
    return request.get("second_hand/getSoldList", where, {
        login: true
    });
}

/**
 * 买到的订单列表
 */
export function getBoughtList(where) {
    return request.get("second_hand/getBoughtList", where, {
        login: true
    });
}

/**
 * 退款列表
 * @returns {*}
 */
export function orderRefund_order(where) {
    return request.get("second_hand/refund_order/list", where, {
        login: true
    });
}

/**
 * 退款订单详情
 */
export function getAdminRefundOrderDetail(orderId) {
    return request.get("second_hand/refund_order/detail/" + orderId, {}, {
        login: true
    });
}

/**
 * 订单确认退款
 */
export function setOrderRefund(data) {
    return request.post("second_hand/order/refund", data, {
        login: true
    });
}

/**
 * 订单详情
 */
export function getOrderDetail(orderId) {
    return request.get("second_hand/order/detail/" + orderId, {}, {
        login: true
    });
}

/**
 * 订单备注
 */
export function setAdminOrderRemark(data) {
    return request.post("second_hand/order/remark", data, {
        login: true
    });
}

/**
 * 订单发货信息获取
 */
export function getAdminOrderDelivery(orderId) {
    return request.get("second_hand/order/delivery/gain/" + orderId, {}, {
            login: true
        }
    );
}

/**
 * 获取物流公司模板
 * @returns {*}
 */
export function orderExportTemp(data) {
    return request.get("second_hand/order/export_temp", data);
}

/**
 * 获取订单打印默认配置
 * @returns {*}
 */
export function orderDeliveryInfo() {
    return request.get("second_hand/order/delivery_info");
}

/**
 * 配送员列表
 * @returns {*}
 */
export function orderOrderDelivery() {
    return request.get("second_hand/order/delivery");
}

/**
 * 获取快递公司
 * @returns {*}
 */
export function getLogistics(data) {
    return request.get("logistics", data, {
        login: false
    });
}

/**
 * 订单发货保存
 */
export function setAdminOrderDelivery(id, data) {
    return request.post("second_hand/order/delivery/keep/" + id, data, {
        login: true
    });
}

/**
 * 订单收货
 * @param string uni
 *
 */
export function orderTake(uni) {
    return request.post('second_hand/order/take', {
        uni: uni
    });
}